package com.song.config.mybatis;

import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.song.util.SnowFlakeUtil;
import org.springframework.stereotype.Component;

/**
 * mybatis自定义主键生成器
 */
@Component
public class CustomIdGernerator implements IdentifierGenerator {
    @Override
    public Number nextId(Object entity) {
        return SnowFlakeUtil.generateId();
    }

    @Override
    public String nextUUID(Object entity) {
        return SnowFlakeUtil.generateStringId();
    }
}
